<?php

use yii\helpers\Html;
use yii\grid\GridView;


$this->title = Yii::t('app', '超期应收款统计');
$this->params['breadcrumbs'][] = $this->title;
?>

<style type="text/css">
    .cs1{margin:2px 5px;} 
</style>

<div class="product-index">

    <div class="box">
        <div class="box-header">
        </div>
        <div class="box-body">
             <?= GridView::widget([
                'dataProvider' => $dataProvider,
                'layout'  =>  "{items}\n{summary}\n{pager}",
                'columns' => [
                    ['class' => 'yii\grid\SerialColumn'],

                    'name',
                    'code',             
                    'price',
                    [
                      'attribute' => '预付金额',
                      'value' => function($model){

                            return $model->incomePrice;
                      }
                    ],
                    [
                      'attribute' => '欠款金额',
                      'value' => function($model){

                            return $model->price - $model->incomePrice;
                      }
                    ],

                    [
                      'attribute' => '账单号',
                      'value' => function($model){

                            return $model->payDate ? $model->payDate->code : ' ';
                      }
                    ],

                    [
                      'attribute' => '预计到款日期',
                      'value' => function($model){

                            return $model->payDate ? $model->payDate->payment_date : ' ';
                      }
                    ],

                    [
                      'attribute' => '逾期时间',
                      'value' => function($model){

                            return $model->overdueTime;
                      }
                    ],


                    [
                        'attribute' => 'status',
                        'filter' =>  Yii::$app->params['product_status'],
                        'value' => function ($model) {
                                return isset(Yii::$app->params['product_status'][$model->status])?Yii::$app->params['product_status'][$model->status]:'';
                            },
                    ],

                    [
                      'attribute' => 'user_id',
                      'value' => function($model){

                            return $model->userName;
                      }
                    ],
                ],
            ]); ?>
          
        </div>
    </div>
</div>
